<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增文章栏目')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-column-add">
			<div class="form-group">	
				<label class="col-sm-2 control-label">栏目名称：</label>
				<div class="col-sm-10">
					<input id="columnName" name="columnName" class="form-control" type="text" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">排序码：</label>
				<div class="col-sm-10">
					<input id="sort" name="sort" class="form-control" type="text" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">备注：</label>
				<div class="col-sm-10">
					<textarea name="remarks" maxlength="500" class="form-control" rows="3">[[*{remarks}]]</textarea>
				</div>
			</div>
		</form>
	</div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = "/sys/column";
		$("#form-column-add").validate({
			onkeyup: false,
			rules: {
				columnName: {
					remote: {
						url: prefix + "/checkColumnNameUnique",
						type: "post",
						dataType: "json",
						data: {
							"columnName": function() {
								return $.common.trim($("#columnName").val());
							}
						},
						dataFilter: function(data, type) {
							return $.validate.unique(data);
						}
					}
				},
			},
			messages: {
				"columnName": {
					remote: "栏目名称已经存在"
				}
			},
			focusCleanup: true
		});
		function submitHandler() {
	        if ($.validate.form()) {
				$.operate.save(prefix + "/saveOrUpdate", $('#form-column-add').serialize());
	        }
	    }
	</script>
</body>
</html>
